# -*- coding: utf-8 -*-
"""
| ==============================================
|
|   Copyright (c) 2025 Nuoyan
|
|   Author: Nuoyan
|   Email : 1279735247@qq.com
|   Gitee : https://gitee.com/charming-lee
|   Date  : 2025-09-26
|
| ==============================================
"""


from typing import Callable, ClassVar, Literal, Tuple, overload, Union, Iterator, Dict
from .._core._types._typing import STuple, FTuple3, FTuple2


__Vector = Union[FTuple3, FTuple2, Vector]
__Vector3 = Union[FTuple3, Vector]


_OP_MAP = Dict[str, Callable]


class Vector(object):
    __slots__: ClassVar[STuple]
    _ZERO_EPS: ClassVar[float]
    x: float
    y: float
    z: float
    _dim: int
    @overload
    def __init__(self: ..., x: float, y: float, z: float, /) -> None: ...
    @overload
    def __init__(self: ..., x: float, y: float, /) -> None: ...
    @overload
    def __init__(self: ..., vec: FTuple3, /) -> None: ...
    @overload
    def __init__(self: ..., vec: FTuple2, /) -> None: ...
    @property
    def dim(self) -> int: ...
    @staticmethod
    def zero(is_3d: bool = True) -> Vector: ...
    @staticmethod
    def one(is_3d: bool = True) -> Vector: ...
    @staticmethod
    def left(is_3d: bool = True) -> Vector: ...
    @staticmethod
    def right(is_3d: bool = True) -> Vector: ...
    @staticmethod
    def up(is_3d: bool = True) -> Vector: ...
    @staticmethod
    def down(is_3d: bool = True) -> Vector: ...
    @staticmethod
    def forward() -> Vector: ...
    @staticmethod
    def backward() -> Vector: ...
    @property
    def length(self) -> float: ...
    @length.setter
    def length(self, val: float) -> None: ...
    @property
    def length2(self) -> float: ...
    def is_zero(self) -> bool: ...
    def normalize(self, inplace: bool = True) -> Vector: ...
    def __neg__(self) -> Vector: ...
    def neg(self, inplace: bool = True) -> Vector: ...
    def __eq__(self, other: __Vector) -> bool: ...
    def __ne__(self, other: __Vector) -> bool: ...
    def copy(self) -> Vector: ...
    __deepcopy__ = __copy__ = copy
    def __repr__(self) -> str: ...
    __str__ = __repr__
    def __getitem__(self, i: Literal[0, 1, 2]) -> float: ...
    def __setitem__(self, i: Literal[0, 1, 2], value: float) -> None: ...
    def __iter__(self) -> Iterator[float]: ...
    def __len__(self) -> int: ...
    def _op(
        self,
        other: __Vector,
        operator: Literal["+", "-", "*", "/", "//"],
        scalar_only: bool = False,
    ) -> Vector: ...
    def _iop(
        self,
        other: __Vector,
        operator: Literal["+=", "-=", "*=", "/=", "//="],
        scalar_only: bool = False,
    ) -> Vector: ...
    def __add__(self, other: __Vector) -> Vector: ...
    def __radd__(self, other: __Vector) -> Vector: ...
    def __iadd__(self, other: __Vector) -> Vector: ...
    def __sub__(self, other: __Vector) -> Vector: ...
    def __rsub__(self, other: __Vector) -> Vector: ...
    def __isub__(self, other: __Vector) -> Vector: ...
    def __mul__(self, other: float) -> Vector: ...
    def __rmul__(self, other: float) -> Vector: ...
    def __imul__(self, other: float) -> Vector: ...
    def __truediv__(self, other: float) -> Vector: ...
    def __itruediv__(self, other: float) -> Vector: ...
    __div__ = __truediv__
    __idiv__ = __itruediv__
    def __floordiv__(self, other: float) -> Vector: ...
    def __ifloordiv__(self, other: float) -> Vector: ...
    def dot(self, vec: __Vector) -> float: ...
    def cross(self, vec: __Vector3, inplace: bool = True) -> Vector: ...


def is_zero_vec(vec: __Vector) -> bool: ...
def _to_vector(vec: __Vector) -> Vector: ...
def set_vec_length(
    vec: __Vector, 
    length: float,
    ret_vector: bool = False,
) -> __Vector: ...
def vec_orthogonal_decomposition(
    vec: __Vector,
    basis1: __Vector,
    basis2: __Vector,
    ret_vector: bool = False,
) -> Tuple[__Vector, __Vector]: ...
def vec_entity_left(
    entity_id: str, 
    ret_vector: bool = False,
) -> __Vector3: ...
def vec_entity_right(
    entity_id: str, 
    ret_vector: bool = False,
) -> __Vector3: ...
def vec_entity_forward(
    entity_id: str, 
    ignore_rot_x: bool = False,
    ret_vector: bool = False,
) -> __Vector3: ...
def vec_entity_backward(
    entity_id: str, 
    ignore_rot_x: bool = False,
    ret_vector: bool = False,
) -> __Vector3: ...
def vec_entity_up(
    entity_id: str, 
    ignore_rot_x: bool = False,
    ret_vector: bool = False,
) -> __Vector3: ...
def vec_entity_down(
    entity_id: str, 
    ignore_rot_x: bool = False,
    ret_vector: bool = False,
) -> __Vector3: ...
def vec_normalize(vec: __Vector, ret_vector: bool = False) -> __Vector: ...
def vec_rot_p2p(pos1: FTuple3, pos2: FTuple3) -> FTuple2: ...
def vec_p2p(
    pos1: FTuple3, 
    pos2: FTuple3, 
    ret_vector: bool = False,
) -> __Vector3: ...
def vec_length(vec: __Vector) -> float: ...
def vec_angle(vec1: __Vector, vec2: __Vector) -> float: ...
def vec_euler_rotate(
    vec: __Vector3,
    x_angle: float = 0.0,
    y_angle: float = 0.0,
    z_angle: float = 0.0,
    order: Literal["zyx", "zxy", "xyz", "xzy", "yxz", "yzx"] = "zyx",
    ret_vector: bool = False,
) -> __Vector3: ...
def vec_rotate_around(
    v: __Vector, 
    u: __Vector,
    angle: float, 
    ret_vector: bool = False,
) -> __Vector: ...
def outgoing_vec(
    vec: __Vector, 
    normal: __Vector,
    ret_vector: bool = False,
) -> __Vector: ...
def vec_composite(
    ret_vector: bool, 
    vec: __Vector, 
    *more_vec: __Vector,
) -> __Vector: ...
def vec_scale(
    vec: __Vector, 
    scale: float, 
    ret_vector: bool = False,
) -> __Vector: ...
